﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.windows.restricted {
    import flash.events.*;
    import flash.display.*;
    import net.wooga.pets.views.windows.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.events.windows.*;
    import org.robotlegs.mvcs.*;
    import flash.errors.*;

    public class BaseWindowMediator extends Mediator {

        public var tickModel:TickModel;

        override public function preRegister():void{
            super.preRegister();
            eventMap.mapListener(this.windowAsSprite, Event.CLOSE, this.onClose);
            eventMap.mapListener(this.windowAsSprite, Event.REMOVED_FROM_STAGE, this.viewRemovedFromDisplayList);
            eventMap.mapListener(this.windowAsSprite, Event.ADDED_TO_STAGE, this.viewAddedToDisplayList);
        }
        protected function onClose(_arg1:Event):void{
            this.onClosing();
        }
        protected function onClosing():void{
            eventMap.unmapListener(this.windowAsSprite, Event.CLOSE, this.onClose);
        }
        protected function onWindowRemoveRequest(_arg1:WindowsMainViewUpdateEvent):void{
            var _local2:IWindowView = _arg1.window;
            if (_local2.id == this.window.id){
                _local2.remove();
            };
        }
        protected function viewAddedToDisplayList(_arg1:Event):void{
            this.window.onAddedToStage();
            this.notifiyMediatorAddedToDisplay();
        }
        private function viewRemovedFromDisplayList(_arg1:Event):void{
            this.window.onRemovedFromStage();
            this.notifiyMediatorRemovedToDisplay();
        }
        protected function notifiyMediatorAddedToDisplay():void{
            throw (new IllegalOperationError("You will need to implement this method"));
        }
        protected function notifiyMediatorRemovedToDisplay():void{
            throw (new IllegalOperationError("You will need to implement this method"));
        }
        protected function get window():IWindowView{
            return ((viewComponent as IWindowView));
        }
        protected function get windowAsSprite():Sprite{
            return ((viewComponent as Sprite));
        }

    }
}//package net.wooga.pets.views.windows.restricted 
